#!/bin/bash

function is_port_listening() {
  echo "Please input port"
  read port
  $(netstat -ntlp| grep -q ${port})
  if [ ${?} -eq 0 ]; then
      echo "${port} is listening"
  else
      echo "${port} is not listening"
  fi
}

is_port_listening